﻿using System.Collections.Generic;
using System.Drawing;
using System.Collections;
using System.IO;
namespace TinyERP.Framework
{
    
    public class IconManager
    {
        public const string DEFAULT_APP = "default";
        private static IconManager iconManager;
        private IconManager()
        {

        }
        public static IconManager GetInstance()
        {
            if (iconManager == null)
            {
                iconManager = new IconManager();
            }
            return iconManager;
        }
        public Image GetAppIcon(string key)
        {
            if (string.IsNullOrEmpty(key))
            {
                return null;
            }
            System.IO.Stream imageStream = this.GetType().Assembly.GetManifestResourceStream(string.Format("TinyERP.Framework.Resources.apps.{0}.png", key));
            return Image.FromStream(imageStream);
        }
             

        public Image GetButton(string key)
        {
            if (string.IsNullOrEmpty(key))
            {
                return null;
            }
            System.IO.Stream imageStream = this.GetType().Assembly.GetManifestResourceStream(string.Format("TinyERP.Framework.Resources.button.{0}.png", key));
            return Image.FromStream(imageStream);
        }

    }
}
